package textExcel;

public class StringCell extends Cell
{
    private final String value;
    
    /**
     * precondition: isValidString(value)
     * @param value
     */
    public StringCell(String value)
    {
    	if(!isValidString(value))
    		throw new IllegalArgumentException("Invalid value");
    	
        this.value = value;
    }
    
    public String toString()
    {
        return this.value;
    }
    
    public static boolean isValidString(String value)
    {
    	return value != null && value.length() > 2 &&
    			value.charAt(0) == '"' &&
    			value.charAt(value.length() - 1) == '"';
    }
}
